﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
namespace MulagoDb.database
{
    public class Fclosure
    {

        public static void insertfclosure_major(int pid, string date, string age, string location, string reason)
        {
            MySqlConnection connection = new MySqlConnection(PatientRegistration.myConString);
            connection.Open();
            MySqlCommand command = connection.CreateCommand();
            string query = "INSERT INTO fclosure_major VALUES(" + pid + ",'" +
                date + "','" + age + "','" +location + "','" + reason + "')";
            command.CommandText = query;
            MySqlDataReader reader = command.ExecuteReader();
            connection.Close();
        }

        public static void insertfclosure_death(int pid, string acutechest, string probableMalaria, string acutepainfull,
            string multorganfailure, string probablesepsis, string stroke, string menengitis, string pulmonaryhypertesion,
            string chronicrenalfailure, string suddendeath, string otherscdrelated, string tbsuspected, string acutesplenic,
            string severeanaemia, string nonscdrelated, string unknown)
        {
            MySqlConnection connection = new MySqlConnection(PatientRegistration.myConString);
            connection.Open();
            MySqlCommand command = connection.CreateCommand();
            string query = "INSERT INTO fclosure_death VALUES(" + pid + ",'" +
                acutechest + "','" + probableMalaria + "','" + acutepainfull + "','" + multorganfailure + "','" +
                probablesepsis + "','" + stroke + "','" + menengitis + "','" + pulmonaryhypertesion + "','" +
                chronicrenalfailure + "','" + suddendeath + "','" + otherscdrelated + "','" + tbsuspected + "','" +
                acutesplenic + "','" + severeanaemia + "','" +nonscdrelated + "','" + unknown + "')";
            command.CommandText = query;
            MySqlDataReader reader = command.ExecuteReader();
            connection.Close();
        }

        public static void insertfclosure_dormantfile(int pid, string date_lastvisit, string age_lastvisit)
        {
            MySqlConnection connection = new MySqlConnection(PatientRegistration.myConString);
            connection.Open();
            MySqlCommand command = connection.CreateCommand();
            string query = "INSERT INTO fclosure_dormantfile VALUES(" + pid + ",'" +
                date_lastvisit+ "','" + age_lastvisit  + "')";
            command.CommandText = query;
            MySqlDataReader reader = command.ExecuteReader();
            connection.Close();
        }
        public static void insertfclosure_other(int pid, string other)
        {
            MySqlConnection connection = new MySqlConnection(PatientRegistration.myConString);
            connection.Open();
            MySqlCommand command = connection.CreateCommand();
            string query = "INSERT INTO fclosure_other VALUES(" + pid + ",'" +
                other  + "')";
            command.CommandText = query;
            MySqlDataReader reader = command.ExecuteReader();
            connection.Close();
        }
    }
}
